package org.infermq.common;

import java.util.logging.Logger;

import javax.jms.ConnectionFactory;

import org.apache.activemq.pool.PooledConnectionFactory;
import org.springframework.jms.core.JmsTemplate;

public class JmsTemplateBuilder {

	private JmsTemplateBuilder() {

	}

	public static JmsTemplate createJmsTemplate(InferMQConfig _config) {
		String jmsServers = _config.getJmsServers();
		logger.info("Creating a JMS Template with the config " + _config);
		ConnectionFactory factory = new PooledConnectionFactory(jmsServers);
		JmsTemplate template = new JmsTemplate(factory);
		return template;

	}

	private static final Logger logger = Logger
			.getLogger(JmsTemplateBuilder.class.toString());
}
